#!/bin/sh
set -e

required_javac_version=1.7.0

javac_version=`javac -version 2>&1 | cut -c 7-`
case ${javac_version} in
    ${required_javac_version}_*)
        echo building with java ${javac_version}
        ;;
    *)
        echo ERROR found Java ${javac_version}, requires ${required_javac_version}
        exit 1
        ;;
esac

version=`git describe --always --tags --match 'v*' --dirty="_patched" | cut -c 2-`
`dirname $0`/gradlew -P-version=$version clean uploadArchives "$@"
